-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip Static test #516
Skip Static test #516
Conversation
eb234fa
to
1206009
Compare
What wrong with staticcheck when run in a container? |
Makefile
Outdated
@@ -23,7 +25,10 @@ install-tools: | |||
hack/install-kubebuilder-tools.sh | |||
|
|||
test: build install-tools | |||
hack/test-go.sh | |||
hack/test-go.sh --skip-static-check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, isn't this going to skip the static check but, we actually want to run it here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no since the default is false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this on my local the logic behaves as expected, if you dont pass in skip-static-check arg it will error out, the way its written currently its not an optional arg
hack/test-go.sh
Outdated
${BASEDIR}/bin/staticcheck --tags=test ./... | ||
if [ $SKIP_STATIC_CHECK ] | ||
then | ||
echo "SKipped golang staticcheck" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Skipped
(not SKipped
)
If we want to call make test in a container running in a cluster we cannot assume that static-check will be installed, and you cant run the This is currently an issue that we are hitting in our (RedHat) downstream testing |
2a7f911
to
6b8ffe7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! looking good
I think Ben's description is incomplete, I think he needs a make target where he can skip this because he's trying to test it a disconnected environment where he can't pull that gomodule, so he needs a target where he can skip it |
echo "define argument -s (skip static check)" | ||
exit 1 | ||
esac | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SKIP_STATIC_CHECK=true
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-s|--skip-static-check)
SKIP_STATIC_CHECK=false
shift
;;
*)
echo "Invalid argument: $1"
echo "Usage: $0 [-s|--skip-static-check]"
exit 1
;;
esac
done
And then you can use it just like ./test.sh --flag-here
and not set true/false
Pull Request Test Coverage Report for Build 12039134565Details
💛 - Coveralls |
In order to run upstream tests in a container with make test we need to be able to skip the static check Signed-off-by: Benjamin Pickard <[email protected]>
5e5ebbd
to
a7ae952
Compare
Thank you! |
In order to run upstream tests in a container with make test we need to be able to skip the static check